package com.myway.utils;


import com.myway.pojo.TabMemberInfo;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

public class UserUtils {

    public  static  String  getUserId(){
        HttpServletRequest request= ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();

        String str = (String)request.getSession().getAttribute("userType");
        if(str!=null){
            String membId="";
            if(str.equals("member")){
                TabMemberInfo mebinf = (TabMemberInfo)request.getSession().getAttribute(str);
                membId = mebinf.getMembId();
            }else if(str.equals("user")){
                membId = (String)request.getSession().getAttribute(str);
            }
            return  membId;
        }
        return  null;
    }
}
